uppercase = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')  
lowercase = set('abcdefghijklmnopqrstuvwxyz')  
digits = set('0123456789')  
underscore = set('_')
keyword = input()
size = len(keyword)
keyword = set(keyword)
type_num = 0
if not keyword.issubset(uppercase | lowercase | digits | underscore) or size <= 6:
    print("Illegal Password")
    exit()
if keyword & uppercase:
    type_num += 1
if keyword & lowercase:
    type_num += 1
if keyword & digits:
    type_num += 1
if keyword & underscore:
    type_num += 1
print(type_num)